package windows;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.JSpinner;

import javax.swing.JPanel;
import javax.swing.JTextArea;

public class ManageRecipeCreate extends JPanel implements ActionListener
{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private JButton btnOk;

	private JLabel lblNameRecipe;
	private JLabel lblCodRecipe;
	private JLabel lbltEgg;
	private JLabel lbtFlour;
	private JLabel lblSugar;
	private JLabel lblMilk;
	private JLabel lblColoring;
	private JLabel lblSabor;
	private JLabel lblStraberry;
	private JLabel lblRaisin;
	private JLabel lblAmount;

	private JTextArea txtNameRecipe;
	private JTextArea txtCodRecipe;

	private JRadioButton rdoEgg;
	private JRadioButton rdoFlour;
	private JRadioButton rdoSugar;
	private JRadioButton rdonMilk;
	private JRadioButton rdoColoring;
	private JRadioButton rdoSabor;
	private JRadioButton rdoStraberry;
	private JRadioButton rdoRaisin;

	private JSpinner spnEgg;
	private JSpinner spnFlour;
	private JSpinner spnSugar;
	private JSpinner spnMilk;
	private JSpinner spnColoring;
	private JSpinner spnSabor;
	private JSpinner spnstraberry;
	private JSpinner spnRaisin;


	public ManageRecipeCreate()
	{
		// TODO Auto-generated constructor stub

		setLayout(null);

		rdoEgg=new JRadioButton();
		rdoEgg.setBounds(230,155, 40, 20);
		rdoEgg.addActionListener(this);
		add(rdoEgg);

		rdoFlour=new JRadioButton();
		rdoFlour.setBounds(230,365, 40, 20);
		rdoFlour.addActionListener(this);
		add(rdoFlour);

		rdoSugar=new JRadioButton();
		rdoSugar.setBounds(230,120, 40, 20);
		rdoSugar.addActionListener(this);
		add(rdoSugar);

		rdonMilk=new JRadioButton();
		rdonMilk.setBounds(230,225, 40, 20);
		rdonMilk.addActionListener(this);
		add(rdonMilk);

		rdoColoring=new JRadioButton();
		rdoColoring.setBounds(230,260, 40, 20);
		rdoColoring.addActionListener(this);
		add(rdoColoring);

		rdoSabor=new JRadioButton();
		rdoSabor.setBounds(230,190, 40, 20);
		rdoSabor.addActionListener(this);
		add(rdoSabor);

		rdoStraberry=new JRadioButton();
		rdoStraberry.setBounds(230,295, 40, 20);
		rdoStraberry.addActionListener(this);
		add(rdoStraberry);

		rdoRaisin=new JRadioButton();
		rdoRaisin.setBounds(230,330, 40, 20);
		rdoRaisin.addActionListener(this);
		add(rdoRaisin);



		/***************************JButton************<code>true</code>**************************/
		btnOk = new JButton("Guardar");
		btnOk.setBounds(170,450, 100, 20);
		btnOk.addActionListener(this);
		add(btnOk);


		/*********************************JSpinner***********************************************/

		spnEgg=new JSpinner();
		spnEgg.setBounds(300, 155, 40, 25);
		spnEgg.setEnabled(false);
		add(spnEgg);

		spnFlour=new JSpinner();
		spnFlour.setBounds(300, 365, 40, 25);
		spnFlour.setEnabled(false);
		add(spnFlour);

		spnSugar=new JSpinner();
		spnSugar.setBounds(300, 120, 40, 25);
		spnSugar.setEnabled(false);
		add(spnSugar);

		spnMilk=new JSpinner();
		spnMilk.setBounds(300, 225, 40, 25);
		spnMilk.setEnabled(false);
		add(spnMilk);

		spnColoring=new JSpinner();
		spnColoring.setBounds(300, 260, 40, 25);
		spnColoring.setEnabled(false);
		add(spnColoring);

		spnSabor=new JSpinner();
		spnSabor.setBounds(300,190, 40, 25);
		spnSabor.setEnabled(false);
		add(spnSabor);

		spnstraberry=new JSpinner();
		spnstraberry.setBounds(300, 295, 40, 25);
		spnstraberry.setEnabled(false);
		add(spnstraberry);

		spnRaisin=new JSpinner();
		spnRaisin.setBounds(300, 330, 40, 25);
		spnRaisin.setEnabled(false);
		add(spnRaisin);


	    /******************************JLabel**********************************/
		lblAmount=new JLabel ("Cantidad gramos");
		lblAmount.setBounds(280, 85, 165, 25);
		add(lblAmount);

		lblCodRecipe=new JLabel("Codigo Receta:");
		lblCodRecipe.setBounds(50, 15, 150, 25);
		add(lblCodRecipe);

		lblNameRecipe = new JLabel("Nombre Receta:");
		lblNameRecipe.setBounds(50, 50, 150, 25);
		add(lblNameRecipe);

		lbtFlour = new JLabel("Harina:");
		lbtFlour.setBounds(50, 365, 150, 25);
		add(lbtFlour);

		lblSugar = new JLabel("Azucar:");
		lblSugar.setBounds(50, 120, 150, 25);
		add(lblSugar);

		lbltEgg=new JLabel("Huevos");
		lbltEgg.setBounds(50, 155, 150, 25);
		add(lbltEgg);

		lblSabor=new JLabel("Saborizantes");
		lblSabor.setBounds(50, 190, 150, 25);
		add(lblSabor);

		lblMilk=new JLabel("Leche:");
		lblMilk.setBounds(50, 225, 150, 25);
		add(lblMilk);

		lblColoring=new JLabel("Colorantes:");
		lblColoring.setBounds(50, 260, 150, 25);
		add(lblColoring);

		lblStraberry=new JLabel("Fresas:");
		lblStraberry.setBounds(50, 295, 150, 25);
		add(lblStraberry);

		lblRaisin=new JLabel("Uvas Pasas:");
		lblRaisin.setBounds(50, 330, 150, 25);
		add(lblRaisin);

		/****************************JTextArea*************************************/
		txtNameRecipe = new JTextArea();
		txtNameRecipe.setBounds(200, 50, 150, 20);
		add(txtNameRecipe);

		txtCodRecipe = new JTextArea();
		txtCodRecipe.setBounds(200, 15, 150, 20);
		txtCodRecipe.setEditable(false);
		add(txtCodRecipe);


		/*******************************************************/


		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		setBounds((screenSize.width-664)/2, (screenSize.height-456)/2, 670, 310);
	}
	


	public void actionPerformed(ActionEvent e)
	{

		if(e.getSource()==btnOk)
		{
		
		}
		if(e.getSource()==rdoColoring)
		{
			spnColoring.setEnabled(true);	
		}
		if(e.getSource()==rdoEgg)
		{
			spnEgg.setEnabled(true);	
		}
		if(e.getSource()==rdoFlour)
		{
		spnFlour.setEnabled(true);	
		}
		if(e.getSource()==rdonMilk)
		{
		spnMilk.setEnabled(true);	
		}
		if(e.getSource()==rdoRaisin)
		{
		spnRaisin.setEnabled(true);	
		}
		if(e.getSource()==rdoSabor)
		{
		spnSabor.setEnabled(true);	
		}
		if(e.getSource()==rdoStraberry)
		{
		spnstraberry.setEnabled(true);	
		}
		if(e.getSource()==rdoSugar)
		{
		spnSugar.setEnabled(true);	
		}
		

		
	}
	
}